Skip to content

Add TypeScript support with full type definitions#5

Draft
mattstabeler with Copilot wants to merge 4 commits into
masterfrom
copilot/update-project-to-typescript
Draft

Add TypeScript support with full type definitions#5
mattstabeler with Copilot wants to merge 4 commits into
masterfrom
copilot/update-project-to-typescript

Conversation

Copilot AI commented Jan 23, 2026

Copy link
Copy Markdown

Migrates the service registry to TypeScript while maintaining 100% backward compatibility with existing JavaScript consumers.

Changes

  • TypeScript Configuration: Added tsconfig.json targeting ES2018/CommonJS with strict mode and declaration generation to lib/
  • Source Migration: Converted services.jssrc/services.ts with full type annotations (method signatures, private properties)
  • Export Strategy: Used export = pattern to preserve original CommonJS semantics—both the singleton instance and Services class remain accessible as before
  • Build Integration: Added build script and prepare hook for automatic compilation; updated package entry points (main, types, files)
  • Cleanup: Removed original JS file, excluded compiled output (lib/) from version control

Usage

JavaScript consumers continue to work unchanged:

const services = require('@bigbadweb/service-registry');
services.register('db', dbInstance);

TypeScript consumers gain type safety:

import services from '@bigbadweb/service-registry';
import { Services } from '@bigbadweb/service-registry';

services.register('api', apiInstance);  // Fully typed
const custom = new Services();          // Create isolated instances

Type definitions exported via .d.ts provide IntelliSense for all methods (get, register, injectService, injectServices).

Original prompt

Update this project to support Typescript


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits January 23, 2026 13:25
- Added TypeScript dependencies
- Created tsconfig.json for compilation
- Converted services.js to services.ts with type definitions
- Updated package.json with build scripts and types
- Maintained full backward compatibility with original API

Co-authored-by: mattstabeler <237220+mattstabeler@users.noreply.github.com>
Co-authored-by: mattstabeler <237220+mattstabeler@users.noreply.github.com>
Co-authored-by: mattstabeler <237220+mattstabeler@users.noreply.github.com>
Copilot AI changed the title [WIP] Update project to support TypeScript Add TypeScript support with full type definitions Jan 23, 2026
Copilot AI requested a review from mattstabeler January 23, 2026 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants